home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 7
/
FM Towns Free Software Collection 7.iso
/
ms_dos
/
thbfc
/
thbfc.c
next >
Wrap
C/C++ Source or Header
|
1993-11-30
|
2KB
|
116 lines
/*
“THbfc”フォント読み出し
By 五味
*/
#include <stdio.h>
#include <stdlib.h>
#include <machine.h>
#include <jctype.h>
#define DOT(n,x,y) (fntbuf[n][y]&((1<<7)>>x))
#define CHR(x,y) (chrbuf[x+y*80])
unsigned char fntbuf[2][16];
unsigned char chrbuf[8*80+1];
int pos;
union {
unsigned char far *code;
unsigned short ad[2];
} fnt;
void get_ankfnt(unsigned char c)
{
int i;
outp(0xff99,1);
fnt.ad[0]=c*16;
fnt.ad[1]=0xcb00;
for( i=0 ; i<16 ; i++ )
fntbuf[0][i]=*(fnt.code++);
outp(0xff99,0); /* ank */
}
void get_kanfnt(unsigned short c)
{
int i;
c=jmstojis(c);
outp(0xff95,(c&0xff));
outp(0xff94,(c >> 8));
for( i=0 ; i<16 ; i++ ) {
fntbuf[0][i]=inp(0xff96);
fntbuf[1][i]=inp(0xff97);
} /* kanji */
}
void initchr()
{
int x,y;
for( y=0 ; y<8 ; y++ )
for( x=0 ; x<80 ; x++ )
CHR(x,y)=' ';
chrbuf[8*80+1]='\0';
pos=0;
}
void putfnt(int f)
{
int x,y;
for( y=0 ; y<8 ; y++ )
for( x=0 ; x<8 ; x++ )
if( DOT(f,x,y*2) )
if( DOT(f,x,y*2+1) )
CHR(pos*8+x+(7-y),y)=';';
else
CHR(pos*8+x+(7-y),y)='\'';
else
if( DOT(f,x,y*2+1) )
CHR(pos*8+x+(7-y),y)=',';
else
CHR(pos*8+x+(7-y),y)=' ';
pos++;
}
int main(int argc,char *argv[])
{
char *p;
if( argc==1 ) {
puts("");
puts(" “THbfc”拡大テキスト文字表示 V1.0");
puts(" (c) H.gomi 1993/03/21");
}
initchr();
for( p=argv[1] ; *p!=NULL ; p++ ) {
if( *p<0x80 || *p>=0xa0 && *p<0xe0 ) {
if( pos>8 ) {
puts(chrbuf);
initchr();
}
get_ankfnt(*p);
putfnt(0);
} else {
get_kanfnt(((unsigned short)*p<<8)+(*(p+1)));
if( pos>7 ) {
puts(chrbuf);
initchr();
}
putfnt(0);
putfnt(1);
p++;
}
}
if( pos )
puts(chrbuf);
}